<template>
  <div class="link flex">
    <table border="1" class="tabledata">
      <tr>
        <td colspan="22" class="bg" style="font-size: 16px; font-weight: bold">净化生产及工艺控制情况</td>
      </tr>
      <tr>
        <td colspan="22">工艺控制情况</td>
      </tr>
      <tr>
        <td><div style="width:40px">项目</div></td>
        <td>设备名称</td>
        <td>单位</td>
        <td>白班</td>
        <td>夜班</td>
        <td colspan="2">项目</td>
        <td colspan="3">设备名称</td>
        <td>单位</td>
        <td colspan="4">指标</td>
      </tr>
      <tr>
        <td rowspan="3">冷凝</td>
        <td>器后温度</td>
        <td>℃</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.qhwdb" v-if="!date.isup"/>
          <span v-else>{{inputs.qhwdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.qhwdy" v-if="!date.isup"/>
          <span v-else>{{inputs.qhwdy}}</span>
        </td>
        <td colspan="2" rowspan="4">硫化氢</td>
        <td colspan="3">鼓冷</td>
        <td>mg/m³</td>
        <td colspan="4">
          <input type="number" class="dinput" v-model="inputs.guleng" v-if="!date.isup"/>
          <span v-else>{{inputs.guleng}}</span>
        </td>
      </tr>
      <tr>
        <td>器前吸力</td>
        <td>Kpa</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.qqxlb" v-if="!date.isup"/>
          <span v-else>{{inputs.qqxlb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.qqxly" v-if="!date.isup"/>
          <span v-else>{{inputs.qqxly}}</span>
        </td>
        <td colspan="3">1#脱硫塔</td>
        <td>mg/m³</td>
        <td colspan="4">
          <input type="number" class="dinput" v-model="inputs.tuoliuta1" v-if="!date.isup"/>
          <span v-else>{{inputs.tuoliuta1}}</span>
        </td>
      </tr>
      <tr>
        <td>循环氨水</td>
        <td>m³/h</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.xhasb" v-if="!date.isup"/>
          <span v-else>{{inputs.xhasb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.xhasy" v-if="!date.isup"/>
          <span v-else>{{inputs.xhasy}}</span>
        </td>
        <td colspan="3">2#脱硫塔</td>
        <td>mg/m³</td>
        <td colspan="4">
          <input type="number" class="dinput" v-model="inputs.tuoliuta2" v-if="!date.isup"/>
          <span v-else>{{inputs.tuoliuta2}}</span>
        </td>
      </tr>
      <tr>
        <td rowspan="3">鼓风机</td>
        <td>机前吸力</td>
        <td rowspan="2">Kpa</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.jqxlb" v-if="!date.isup"/>
          <span v-else>{{inputs.jqxlb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.jqxly" v-if="!date.isup"/>
          <span v-else>{{inputs.jqxly}}</span>
        </td>
        <td colspan="3">饱和器出口</td>
        <td>mg/m³</td>
        <td colspan="4">
          <input type="number" class="dinput" v-model="inputs.bhqck" v-if="!date.isup"/>
          <span v-else>{{inputs.bhqck}}</span>
        </td>
      </tr>
      <tr>
        <td>机后压力</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.jhylb" v-if="!date.isup"/>
          <span v-else>{{inputs.jhylb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.jhyly" v-if="!date.isup"/>
          <span v-else>{{inputs.jhyly}}</span>
        </td>
        <td colspan="2" rowspan="4">污水处理</td>
        <td colspan="3"></td>
        <td style="width: 60px">单位</td>
        <td colspan="2">日处理量</td>
        <td colspan="2">月累计处理量</td>
      </tr>
      <tr>
        <td>煤气流量</td>
        <td>m³/h</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.mqllb" v-if="!date.isup"/>
          <span v-else>{{inputs.mqllb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.mqlly" v-if="!date.isup"/>
          <span v-else>{{inputs.mqlly}}</span>
        </td>
        <td colspan="3">新生化</td>
        <td>t</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="inputs.xshr" v-if="!date.isup"/>
          <span v-else>{{inputs.xshr}}</span>
        </td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="inputs.xshy" v-if="!date.isup"/>
          <span v-else>{{inputs.xshy}}</span>
        </td>
      </tr>
      <tr>
        <td rowspan="3">蒸氨</td>
        <td>塔顶温度</td>
        <td>℃</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.tdwdb" v-if="!date.isup"/>
          <span v-else>{{inputs.tdwdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.tdwdy" v-if="!date.isup"/>
          <span v-else>{{inputs.tdwdy}}</span>
        </td>
        <td colspan="3">老生化</td>
        <td>t</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="inputs.lshr" v-if="!date.isup"/>
          <span v-else>{{inputs.lshr}}</span>
        </td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="inputs.lshy" v-if="!date.isup"/>
          <span v-else>{{inputs.lshy}}</span>
        </td>
      </tr>
      <tr>
        <td>塔底压力</td>
        <td>Kpa</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.tdylb" v-if="!date.isup"/>
          <span v-else>{{inputs.tdylb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.tdyly" v-if="!date.isup"/>
          <span v-else>{{inputs.tdyly}}</span>
        </td>
        <td colspan="3">深度处理</td>
        <td>t</td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="inputs.sdclr" v-if="!date.isup"/>
          <span v-else>{{inputs.sdclr}}</span>
        </td>
        <td colspan="2">
          <input type="number" class="dinput" v-model="inputs.sdcly" v-if="!date.isup"/>
          <span v-else>{{inputs.sdcly}}</span>
        </td>
      </tr>
      <tr>
        <td>剩余氨水去蒸氨塔</td>
        <td>m³</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.syasb" v-if="!date.isup"/>
          <span v-else>{{inputs.syasb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.syasy" v-if="!date.isup"/>
          <span v-else>{{inputs.syasy}}</span>
        </td>
        <td colspan="10">产量</td>
      </tr>
      <tr>
        <td rowspan="3">硫铵</td>
        <td>母液酸度</td>
        <td>%</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.mysdb" v-if="!date.isup"/>
          <span v-else>{{inputs.mysdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.mysdy" v-if="!date.isup"/>
          <span v-else>{{inputs.mysdy}}</span>
        </td>
        <td colspan="3">产品名称</td>
        <td style="width: 70px">单位</td>
        <td colspan="3">日产量</td>
        <td colspan="3">月累计产量</td>
      </tr>
      <tr>
        <td>母液温度</td>
        <td>℃</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.mywdb" v-if="!date.isup"/>
          <span v-else>{{inputs.mywdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.mywdy" v-if="!date.isup"/>
          <span v-else>{{inputs.mywdy}}</span>
        </td>
        <td colspan="3">煤气</td>
        <td>万m³</td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.meiqir" v-if="!date.isup"/>
          <span v-else>{{inputs.meiqir}}</span>
        </td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.meiqiy" v-if="!date.isup"/>
          <span v-else>{{inputs.meiqiy}}</span>
        </td>
      </tr>
      <tr>
        <td>饱和器阻力</td>
        <td>Kpa</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.bhqzlb" v-if="!date.isup"/>
          <span v-else>{{inputs.bhqzlb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.bhqzly" v-if="!date.isup"/>
          <span v-else>{{inputs.bhqzly}}</span>
        </td>
        <td colspan="3">焦油</td>
        <td>t</td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.jiaoyour" v-if="!date.isup"/>
          <span v-else>{{inputs.jiaoyour}}</span>
        </td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.jiaoyouy" v-if="!date.isup"/>
          <span v-else>{{inputs.jiaoyouy}}</span>
        </td>
      </tr>
      <tr>
        <td rowspan="5">粗苯</td>
        <td>终冷塔后煤气温度</td>
        <td>℃</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.zltwdb" v-if="!date.isup"/>
          <span v-else>{{inputs.zltwdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.zltwdy" v-if="!date.isup"/>
          <span v-else>{{inputs.zltwdy}}</span>
        </td>
        <td colspan="3">硫铵</td>
        <td>t</td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.liuanr" v-if="!date.isup"/>
          <span v-else>{{inputs.liuanr}}</span>
        </td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.liuany" v-if="!date.isup"/>
          <span v-else>{{inputs.liuany}}</span>
        </td>
      </tr>
      <tr>
        <td>富油预热温度</td>
        <td>℃</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.fyyrwdb" v-if="!date.isup"/>
          <span v-else>{{inputs.fyyrwdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.fyyrwdy" v-if="!date.isup"/>
          <span v-else>{{inputs.fyyrwdy}}</span>
        </td>
        <td colspan="3">粗苯</td>
        <td>t</td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.cubenr" v-if="!date.isup"/>
          <span v-else>{{inputs.cubenr}}</span>
        </td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.cubeny" v-if="!date.isup"/>
          <span v-else>{{inputs.cubeny}}</span>
        </td>
      </tr>
      <tr>
        <td>富油流量</td>
        <td>m³/h</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.fyllb" v-if="!date.isup"/>
          <span v-else>{{inputs.fyllb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.fylly" v-if="!date.isup"/>
          <span v-else>{{inputs.fylly}}</span>
        </td>
        <td colspan="3">硫磺</td>
        <td>t</td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.liuhuangr" v-if="!date.isup"/>
          <span v-else>{{inputs.liuhuangr}}</span>
        </td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.liuhuangy" v-if="!date.isup"/>
          <span v-else>{{inputs.liuhuangy}}</span>
        </td>
      </tr>
      <tr>
        <td>冷贫油温度</td>
        <td>℃</td>
        <td>
          <input type="number" class="dinput" v-model="inputs.lpywdb" v-if="!date.isup"/>
          <span v-else>{{inputs.lpywdb}}</span>
        </td>
        <td>
          <input type="number" class="dinput" v-model="inputs.lpywdy" v-if="!date.isup"/>
          <span v-else>{{inputs.lpywdy}}</span>
        </td>
        <td colspan="3">副盐</td>
        <td>包</td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.fuyanr" v-if="!date.isup"/>
          <span v-else>{{inputs.fuyanr}}</span>
        </td>
        <td colspan="3">
          <input type="number" class="dinput" v-model="inputs.fuyany" v-if="!date.isup"/>
          <span v-else>{{inputs.fuyany}}</span>
        </td>
      </tr>
      <tr>
        <td colspan="15" style="text-align: left">
          <textarea cols="210" v-model="inputs.content" v-if="!date.isup"></textarea>
          <div v-else style="white-space: pre-line;text-align: left;">{{inputs.content}}</div>
        </td>
      </tr>
    </table>
  </div>
</template>

<script lang="ts" setup name="jhscjgykzqk">
import cache from "@/utils/cache";
import { getJhscjgykzqk, jhscjgykzqkSave, jhscjgykzqkSubmit } from "@/api/report";

let obj = {
  // 左侧
  qhwdb:0,
  qhwdy:0,
  qqxlb:0,
  qqxly:0,
  xhasb:0,
  xhasy:0,
  jqxlb:0,
  jqxly:0,
  jhylb:0,
  jhyly:0,
  mqllb:0,
  mqlly:0,
  tdwdb:0,
  tdwdy:0,
  tdylb:0,
  tdyly:0,
  syasb:0,
  syasy:0,
  mysdb:0,
  mysdy:0,
  mywdb:0,
  mywdy:0,
  bhqzlb:0,
  bhqzly:0,
  zltwdb:0,
  zltwdy:0,
  zqylb:0,
  zqyly:0,
  fyyrwdb:0,
  fyyrwdy:0,
  fyllb:0,
  fylly:0,
  lpywdb:0,
  lpywdy:0,
  // 右侧
  guleng:0,
  tuoliuta1:0,
  tuoliuta2:0,
  bhqck:0,
  xshr:0,
  xshy:0,
  lshr:0,
  lshy:0,
  sdclr:0,
  sdcly:0,
  meiqir:0,
  meiqiy:0,
  jiaoyour:0,
  jiaoyouy:0,
  liuanr:0,
  liuany:0,
  cubenr:0,
  cubeny:0,
  liuhuangr:0,
  liuhuangy:0,
  fuyanr:0,
  fuyany:0,
  content:'记事：'
}
// 整表 数据绑定
const inputs = ref(obj);

const save = async () => {
  let userInfo = cache.get('userInfo')
  await jhscjgykzqkSave({
    inputs:inputs.value,
    aid: userInfo.id,
    aname: userInfo.name,
    date:date.date,
  })
}
const uuuu = ref(cache.get('role_name'))
// 提交方法，调用接口
const submit = async () => {
  await jhscjgykzqkSubmit({
    label:uuuu.value,
    date:date.date,
  })
}

onMounted(() => {
  getData()
})

const getData = async () => {
  getJhscjgykzqk(date).then((res)=>{
    if(res.length==0){
      inputs.value = obj
    }else{
      inputs.value = res
    }
  })
}
const date = defineProps(['date','isup'])
watch(date, async (n) => {
  getData()
})

defineExpose({
  save,
  submit
})
</script>

<style lang="scss" scoped>
.tabledata {
  width: 100%;
  border: 1px solid #aaa;
  td {
    text-align: center;
    border: 1px solid #aaa;
    padding: 3px;
  }
  .bg{
    background: #ccc;
  }
  .dinput{
    text-align: center;
    border-radius: 5px;
    width: 80px;
    border: 1px solid #ccc;
  }
}
</style>
